package com.itboye.jinpuyiyuan.activity.me;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.itboye.jinpuyiyuan.R;
import com.itboye.jinpuyiyuan.adapter.IllRecordAdapter;
import com.itboye.jinpuyiyuan.base.BaseActivity;
import com.itboye.jinpuyiyuan.bean.CeshiBean;

import java.util.ArrayList;
import java.util.List;

/**
 * 病史记录
 */
public class IllRecordActivity extends BaseActivity {
    //title
    private ImageView leftImg,rightImg;
    private TextView leftTv,tvTitle;
    private RelativeLayout rlLeft,toobar;

    private LinearLayout allLl,departmentLl,hospitalLL,testLl;
    private Button hospitalBtn,testBtn,departmentBtn,allBtn;
    ListView payment_list;
    IllRecordAdapter adapter;
    private List<CeshiBean> list;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_ill);


        rightImg.setVisibility(View.GONE);
        leftTv.setVisibility(View.GONE);
        tvTitle.setText("病史记录");
        list=new ArrayList<>();
        for (int i=0;i<4;i++){
            CeshiBean bean = new CeshiBean();
            bean.setTitle("2013-7-7");
            list.add(bean);
        }
        adapter=new IllRecordAdapter(this,list,R.layout.item_ill_records);
        payment_list.setAdapter(adapter);
    }
    @Override
    public void onClick(View view) {
        super.onClick(view);
        switch (view.getId()) {

            case R.id.rlLeft:
            case R.id.leftImg:
                this.finish();
                break;
            case R.id.allLl://全部
            case R.id.allBtn:
                cancelTable();
                allBtn.setBackgroundResource(R.drawable.login_corner_bluesolid_btn);
                allBtn.setTextColor(getResources().getColor(R.color.white));
                break;

            case R.id.departmentLL://门诊
            case R.id.departmentBtn:
                cancelTable();
                departmentBtn.setBackgroundResource(R.drawable.login_corner_bluesolid_btn);
                departmentBtn.setTextColor(getResources().getColor(R.color.white));
                break;

            case R.id.hospitalLL://住院
            case R.id.hospitalBtn:
                cancelTable();
                hospitalBtn.setBackgroundResource(R.drawable.login_corner_bluesolid_btn);
                hospitalBtn.setTextColor(getResources().getColor(R.color.white));
                break;

            case R.id.testLl://体检
            case R.id.testBtn:
                cancelTable();
                testBtn.setBackgroundResource(R.drawable.login_corner_bluesolid_btn);
                testBtn.setTextColor(getResources().getColor(R.color.white));
                break;



        }
    }

    public void cancelTable(){
        allBtn.setBackgroundResource(R.drawable.login_corner_grayedge);
        departmentBtn.setBackgroundResource(R.drawable.login_corner_grayedge);
        hospitalBtn.setBackgroundResource(R.drawable.login_corner_grayedge);
        testBtn.setBackgroundResource(R.drawable.login_corner_grayedge);
        allBtn.setTextColor(getResources().getColor(R.color.black));
        departmentBtn.setTextColor(getResources().getColor(R.color.black));
        hospitalBtn.setTextColor(getResources().getColor(R.color.black));
        testBtn.setTextColor(getResources().getColor(R.color.black));
    }
}
